package com.filetransfer.view;
import com.filetransfer.view.Components.SideMenu;
import com.filetransfer.view.Panel.MainPagePanel;
import com.filetransfer.view.Panel.SettingPanel;
import com.filetransfer.view.Panel.StatisticsPanel;
import com.filetransfer.view.Panel.TabbedPanel;
import raven.toast.Notifications;

import javax.swing.*;
import java.awt.*;
public class MainFrame {
    private final CardLayout cardLayout = new CardLayout();
    private final JPanel mainPanel = new JPanel(cardLayout);
    public MainFrame() {
        JFrame frame = new JFrame("File Transfer Assistant");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(800, 600);
        frame.setLayout(new BorderLayout());
        Notifications.getInstance().setJFrame(frame);
        mainPanel.add(new MainPagePanel(), "MainPage");
        mainPanel.add(TabbedPanel.createTabbedPane(), "UploadDownload");
        mainPanel.add(new StatisticsPanel(), "Stats");
        mainPanel.add(new SettingPanel(), "Settings");
        SideMenu sideMenu = new SideMenu(cardLayout, mainPanel);
        sideMenu.addMenuButton("MainPage", "主页", "icons/home.svg");
        sideMenu.addMenuButton("UploadDownload", "传输", "icons/swap.svg");
        sideMenu.addMenuButton("Stats", "统计", "icons/monitoring.svg");
        sideMenu.addBottomButton("Settings", "设置", "icons/settings.svg");
        frame.add(sideMenu, BorderLayout.WEST);
        frame.add(mainPanel, BorderLayout.CENTER);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}
